package compableAndcompletor;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class Main {

    public static void main1(String[] args) {

        List<User> users = List.of(new User(3), new User(1), new User(5));
        Comparator<User> comparator = (o1, o2) -> o2.getAge() - o1.getAge();
//        List<User> collect = users.stream().sorted().collect(Collectors.toList());
        List<User> collect = users.stream().sorted(comparator).collect(Collectors.toList());
        System.out.println(collect);


    }

    public static void main(String[] args) {
        String s = "[{\"duration\":59,\"fileName\":\"18733566568_wx_张帆18733566568-2023-04-18_15-55-20_wxMini_68717677.mp4\",\"downUrl\":\"https://f1.cloudroom.com:7171/M00/49/C1/oYYBAGQ-TSeAY0vnADaqc_g2cow2463646?name=18733566568_wx_张帆18733566568-2023-04-18_15-55-20_wxMini_68717677.mp4\",\"fileSize\":\"3.4M\",\"filePath\":\"/2023-04-18/18733566568_wx_张帆18733566568-2023-04-18_15-55-20_wxMini_68717677.mp4\",\"ctime\":\"2023-04-18 15:56:22\",\"id\":38268250}," +
                "{\"duration\":59,\"fileName\":\"18733566568_wx_张帆18733566568-2023-04-18_15-55-20_wxMini_68717677.mp4\",\"downUrl\":\"https://f1.cloudroom.com:7171/M00/49/C1/oYYBAGQ-TSeAY0vnADaqc_g2cow2463646?name=18733566568_wx_张帆18733566568-2023-04-18_15-55-20_wxMini_68717677.mp4\",\"fileSize\":\"3.4M\",\"filePath\":\"/2023-04-18/18733566568_wx_张帆18733566568-2023-04-18_15-55-20_wxMini_68717677.mp4\",\"ctime\":\"2023-04-18 15:56:22\",\"id\":38268250}]";
        JSONArray objects = JSONUtil.parseArray(s);
        for (Object object : objects) {

        }

    }
}
